package com.chaoyong.higo.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.chaoyong.higo.R;
import com.chaoyong.higo.base.BaseAdapter;
import com.chaoyong.higo.utils.ViewHolder;

public class RecordDialogAdapter extends BaseAdapter<String> {

	private TextView codes_in_dialog;

	public RecordDialogAdapter(Context context,List<String> codes) {
		super(context);
		mList = codes;
		//mList.remove(mList.size() - 1);
		//removeEmptyList(mList);
	}
	
	private List<String> removeEmptyList(List<String> list) {  
        List<String> list1 = new ArrayList<String>();  
          
        if(list==null||list.size()<=0)  
            return null;  
        //循环第一层  
        for(int i=0;i<list.size();i++) {  
            //进入每一个list  
            String listi = list.get(i);  
            if(!listi.equals(""))  
                list1.add(listi);  
        }  
          
        return list1;  
    }  

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.item_record_dialog, null);
		}

		codes_in_dialog = ViewHolder.get(convertView, R.id.codes_in_dialog);

		String code = mList.get(position);
		if(!code.equals("")){
			codes_in_dialog.setText((Integer.parseInt(code) + 10000000) + "");
		}
		//codes_in_dialog.setText((Integer.parseInt(mList.get(position)) + 10000000) + "");
		return convertView;
	}

}
